package com.itheima.reggie.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.reggie.Util.Page;
import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.Dish;
import com.itheima.reggie.entity.vo.GetDishVo;
import com.itheima.reggie.service.IDishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * <p>
 * 菜品管理 前端控制器
 * </p>
 *
 * @author 陈振豪
 * @since 2024-10-02
 */
@RestController
@RequestMapping("/dish")
public class DishController {

    @Autowired
    private IDishService iDishService;

//    http://localhost:8080/dish/page?page=1&pageSize=10
    @GetMapping("/page")
    public R<Page> getDishPage(int page, int pageSize,String name) {
        return iDishService.getDishPage(page,pageSize,name);
    }

//    http://localhost:8080/dish/1397850140982161409
    @GetMapping("/{id}")
    public R<GetDishVo> getOneDish(@PathVariable Long id) {
        return iDishService.getOneDish(id);
    }

}
